class SRVetSharpshooter extends SRVeterancy
	abstract;
	
static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
	switch( CurLevel )
	{
	case 0:
		FinalInt = 0;
		break;
	case 1:
		FinalInt = 500000; // 0.5M
		break;
	case 2:
		FinalInt = 1500000; // 1M
		break;
	case 3:
		FinalInt = 3500000; // 2M
		break;
	case 4:
		FinalInt = 6000000; // 2.5M
		break;
	case 5:
		FinalInt = 10000000; // 4M
		break;
	case 6:
		FinalInt = 17000000; // 7M
		break;
	case 7:
		FinalInt = 27000000; // 10M
		break;
	case 8:
		FinalInt = 40000000; // 13M
		break;
	default:
		FinalInt = 60000000 * ( CurLevel - 8 );
	}
	return Min(StatOther.RHeadshotKillsStat,FinalInt);
}

/*
static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
	switch( CurLevel )
	{
	case 0:
		FinalInt = 0;
		break;
	case 1:
		FinalInt = 750;
		break;
	case 2:
		FinalInt = 2250; // 1500 headshots
		break;
	case 3:
		FinalInt = 5250; // 3000 headshots
		break;
	case 4:
		FinalInt = 9000; // 3750 headshots
		break;
	case 5:
		FinalInt = 15000; // 6000 headshots
		break;
	case 6:
		FinalInt = 30000; // 15000 headshots
		break;
	case 7:
		FinalInt = 52500; // 22500 headshots
		break;
	case 8:
		FinalInt = 82500; // 30000 headshots
		break;
	case 9:
		FinalInt = 120000; // 37500 headshots
		break;
	case 10:
		FinalInt = 240000; // 120000 headshots
		break;
	default:
		FinalInt = 1000000;
	}
	return Min(StatOther.RHeadshotKillsStat,FinalInt);
}
*/

static function float GetHeadShotDamMulti(KFPlayerReplicationInfo KFPRI, KFPawn P, class<DamageType> DmgType)
{
	local float ret;
	
	if ( DmgType == class'DamTypeM99SR' )
	{
		return 2.0 + 0.5 * float(Min(KFPRI.ClientVeteranSkillLevel,9));
	}

	if ( DmgType == class'DamTypeCrossbow' || DmgType == class'DamTypeCrossbowHeadShot' || DmgType == class'DamTypeSVDc' || DmgType == class'DamTypeSVUK'
		|| DmgType == class'DamTypeSVU' || DmgType == class'DamTypeSHeadshot' || DmgType == class'DamTypeHK417SR' || DmgType == class'DamTypeHuntingRifle'
		|| DmgType == class'DamTypeSVDcHeadshot' || DmgType == class'DamTypeOpticalDeagle' || DmgType == class'DamTypeHeadshotFrag'
		|| DmgType == class'DamTypeDualies' || class<DamTypeSharpshooter>(DmgType) != none )
	{
		switch( KFPRI.ClientVeteranSkillLevel )
		{
			case 0:
			  ret = 1.30;
			  break;
			case 1:
			  ret = 1.35;
			  break;
			case 2:
			  ret = 1.40;
			  break;
			case 3:
			  ret = 1.50;
			  break;
			case 4:
			  ret = 1.60;
			  break;
			case 5:
			  ret = 1.70;
			  break;
			case 6:
			  ret = 1.80;
			  break;
			case 7:
			  ret = 1.95;
			  break;
			case 8:
			  ret = 2.10;
			  break;
			case 9:
			case 10:
			  ret = 2.25;
			  break;
		}
	}
	else
	{
		ret = 1.0;
	}
	
	switch( KFPRI.ClientVeteranSkillLevel )
	{
		case 0:
		  ret += 0.25;
		  break;
		case 1:
		  ret += 0.30;
		  break;
		default:
		  ret += 0.30 + float(Min(KFPRI.ClientVeteranSkillLevel,9)) * 0.05;
		  break;
	}
	
	if( ( DmgType == class'DamTypeCrossbow' || DmgType == class'DamTypeCrossbowHeadShot' ) && KFPRI.ClientVeteranSkillLevel > 9 )
		ret *= 2.0;

	return ret * Super.GetHeadShotDamMulti(KFPRI,P,DmgType);
}

static function float ModifyRecoilSpread(KFPlayerReplicationInfo KFPRI, WeaponFire Other, out float Recoil)
{
	if ( Crossbow(Other.Weapon) != none || Single(Other.Weapon) != none || Dualies(Other.Weapon) != none
	    || SVU(Other.Weapon) != none || SVDc(Other.Weapon) != none || HK417SniperRifle(Other.Weapon) != none
		|| BDHuntingRifle(Other.Weapon) != none || M99New(Other.Weapon) != none || OpticalDeagle(Other.Weapon) != none
		|| P57LLI(Other.Weapon) != none )
	{
		if ( KFPRI.ClientVeteranSkillLevel < 5)
			Recoil = 0.25;
		else if ( KFPRI.ClientVeteranSkillLevel < 8 )
			Recoil = 0.20;
		else if ( KFPRI.ClientVeteranSkillLevel < 9 )
			Recoil = 0.15;
		else Recoil = 0.10; // 90% recoil reduction with sniper weapons
		return Recoil * GetProperRecoilSpread(Other);
	}
	Recoil = 1.0;
	Return Recoil * GetProperRecoilSpread(Other);
}

// Modify fire speed
static function float GetFireSpeedMod(KFPlayerReplicationInfo KFPRI, Weapon Other)
{
	if ( BDHuntingRifle(Other) != none )
	{
		return ( 1.3 + (0.10 * float(Min(9,KFPRI.ClientVeteranSkillLevel))) ) * Super.GetFireSpeedMod(KFPRI,Other); // Up to 120% faster fire rate with Remmington
	}
	
	if ( Crossbow(Other) != none || SVDc(Other) != none || M99New(Other) != none )
	{
		return 1.18 + 0.02 * float(Min(9,KFPRI.ClientVeteranSkillLevel));
	}
	return Super.GetFireSpeedMod(KFPRI,Other);
}

static function float GetReloadSpeedModifier(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	if ( BDHuntingRifle(Other) != none )
	{
		return ( 1.3 + (0.10 * float(Min(9,KFPRI.ClientVeteranSkillLevel))) ) * Super.GetReloadSpeedModifier(KFPRI,Other);
	}
	if ( Single(Other) != none || Dualies(Other) != none || SVU(Other) != none || SVDc(Other) != none
		|| HK417SniperRifle(Other) != none || OpticalDeagle(Other) != none || P57LLI(Other) != none )
	{
		if ( KFPRI.ClientVeteranSkillLevel == 0 )
			return 1.30 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 1 )
			return 1.40 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 2 )
			return 1.50 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 3 )
			return 1.60 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 4 )
			return 1.65 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 5 )
			return 1.70 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 6 )
			return 1.75 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 7 )
			return 1.80 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel == 8 )
			return 1.85 * Super.GetReloadSpeedModifier(KFPRI,Other);
		else if ( KFPRI.ClientVeteranSkillLevel > 8 )
			return 1.90 * Super.GetReloadSpeedModifier(KFPRI,Other);
	}
	return Super.GetReloadSpeedModifier(KFPRI,Other);
}

static function class<Grenade> GetNadeType(KFPlayerReplicationInfo KFPRI)
{
	return class'SharpNade';
}

// Change the cost of particular items
static function float GetCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	if ( Item == class'OpticalDeaglePickup' || Item == class'SVUPickup' || Item == class'SVDcPickup'
		|| Item == class'HK417Pickup' || Item == class'BDHuntingRiflePickup' || Item == class'P57LLIPickup' )
		return GetDefaultCostScaling(KFPRI.ClientVeteranSkillLevel) * GetProperCostScaling(Item);
	return GetProperCostScaling(Item);
}

static function float GetAmmoCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
/*
	if ( Item == class'CrossbowPickup' )
		return FMax(0.86 - (0.07 * float(KFPRI.ClientVeteranSkillLevel)),0.1f) * GetProperAmmoCostScaling(Item);
*/
	return GetProperAmmoCostScaling(Item);
}

// Give Extra Items as Default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	super.AddDefaultInventory(KFPRI,P);
	
	if ( SRPlayerReplicationInfo(KFPRI).bRespawned )
		return;

	if ( KFPRI.ClientVeteranSkillLevel > 2 && KFPRI.ClientVeteranSkillLevel < 6 )
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.BDHuntingRifle", GetCostScaling(KFPRI, class'BDHuntingRiflePickup'));

	if ( KFPRI.ClientVeteranSkillLevel > 5 && KFPRI.ClientVeteranSkillLevel < 9 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.Crossbow", GetCostScaling(KFPRI, class'CrossbowPickup'));

	if ( KFPRI.ClientVeteranSkillLevel > 8 )
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.M99New", 0.30);
		
	SRPlayerReplicationInfo(KFPRI).bRespawned = true;
}

static function float AddExtraAmmoFor(KFPlayerReplicationInfo KFPRI, Class<Ammunition> AmmoType)
{
	local float ret;
	
	ret = 1.00;
	
	if ( AmmoType == class'M99NewAmmo' )
	{
		ret = 1.00 + 0.067 * float(Min(9,KFPRI.ClientVeteranSkillLevel));
	}

	if ( ( AmmoType == class'SingleAmmo' || AmmoType == class'OpticalDeagleAmmo' || AmmoType == class'CrossbowAmmo'
		|| AmmoType == class'SVUAmmo' || AmmoType == class'SVDcAmmo' || AmmoType == class'HK417Ammo'
		|| AmmoType == class'BDHuntingRifleAmmo' || AmmoType == class'M99NewAmmo' || AmmoType == class'P57LLIAmmo' )
		&& KFPRI.ClientVeteranSkillLevel > 9 )
	{
		ret *= 1.35;
	}
	else if ( AmmoType == class'FragAmmo' || AmmoType == class'Frag1Ammo' )
	{
		if( KFPRI.ClientVeteranSkillLevel < 5 )
			ret = 1.0;
		else if( KFPRI.ClientVeteranSkillLevel > 4 )
			ret = ( 0.20 + 0.20 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) ) * GetProperAmmoAmount(AmmoType); // 10 grenades
	}

	return ret * GetProperAmmoAmount(AmmoType);
}

static function bool IsPerkTarget(PlayerReplicationInfo PRI, class<Actor> TargetClass)
{
	if ( TargetClass == class'DKFleshpound' || TargetClass == class'DKDeathKnight'
		|| TargetClass == class'DKHusk' || TargetClass == class'DKDemolisher' )
	{
		return true;
	}

	return Super.IsPerkTarget(PRI,TargetClass);
}

static function string GetPickupShopName(KFPlayerReplicationInfo KFPRI, Class<Pickup> PickupClass, optional int FireModeNum)
{
	if ( PickupClass == class'Frag1Pickup' )
		return "Headshot Nade";
	
	return Super.GetPickupShopName(KFPRI,PickupClass);
}

defaultproperties
{
     CustomLevelInfo="%s more headshot damage with 9mm, Handcannon, Rifle, Crossbow, and M14|75% less recoil with Handcannon, Rifle, Crossbow, and M14|%p faster reload with Handcannon, Rifle, Crossbow, and M14|50% extra headshot damage|%d discount on Handcannon/HK417/M99|Spawn with a Crossbow"
     PerkIndex=2
	 BronzeIcon=Texture'SunriseHUD.Icons.Perk_SharpShooter_Bronze'
	 SilverIcon=Texture'SunriseHUD.Icons.Perk_SharpShooter_Silver'
	 GoldIcon=Texture'SunriseHUD.Icons.Perk_SharpShooter_Gold'
     OnHUDIcon=Texture'KillingFloorHUD.Perks.Perk_SharpShooter'
     OnHUDGoldIcon=Texture'KillingFloor2HUD.Perk_Icons.Perk_SharpShooter_Gold'
     VeterancyName="Sharpshooter"
     Requirements(0)="Get %x headshot damage with sniper weapons"
     SRLevelEffects(0)="55% more headshot damage with optical weapons|25% more headshot damage with other weapons|100% extra headshot damage with an M99 AMR|18% faster fire speed with Crossbow/SVDc/M99|75% less recoil with optical weapons and 9mm tactical|Can carry 5 head-hurting grenades|30% faster reload with optical weapons and 9mm tactical|50% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD"
     SRLevelEffects(1)="65% more headshot damage with optical weapons|30% more headshot damage with other weapons|150% extra headshot damage with an M99 AMR|20% faster fire speed with Crossbow/SVDc/M99|75% less recoil with optical weapons and 9mm tactical|Can carry 5 head-hurting grenades|40% faster reload with optical weapons and 9mm tactical|55% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD"
     SRLevelEffects(2)="80% more headshot damage with optical weapons|40% more headshot damage with other weapons|200% extra headshot damage with an M99 AMR|22% faster fire speed with Crossbow/SVDc/M99|75% less recoil with optical weapons and 9mm tactical|Can carry 5 head-hurting grenades|50% faster reload with optical weapons and 9mm tactical|60% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD"
     SRLevelEffects(3)="95% more headshot damage with optical weapons|45% more headshot damage with other weapons|250% extra headshot damage with an M99 AMR|24% faster fire speed with Crossbow/SVDc/M99|75% less recoil with optical weapons and 9mm tactical|Can carry 5 head-hurting grenades|60% faster reload with optical weapons and 9mm tactical|65% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with a Hunting Rifle"
     SRLevelEffects(4)="110% more headshot damage with optical weapons|50% more headshot damage with other weapons|300% extra headshot damage with an M99 AMR|26% faster fire speed with Crossbow/SVDc/M99|75% less recoil with optical weapons and 9mm tactical|Can carry 5 head-hurting grenades|65% faster reload with optical weapons and 9mm tactical|70% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with a Hunting Rifle"
     SRLevelEffects(5)="125% more headshot damage with optical weapons|55% more headshot damage with other weapons|350% extra headshot damage with an M99 AMR|28% faster fire speed with Crossbow/SVDc/M99|80% less recoil with optical weapons and 9mm tactical|Can carry 6 head-hurting grenades|70% faster reload with optical weapons and 9mm tactical|70% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with a Hunting Rifle"
     SRLevelEffects(6)="140% more headshot damage with optical weapons|60% more headshot damage with other weapons|400% extra headshot damage with an M99 AMR|30% faster fire speed with Crossbow/SVDc/M99|80% less recoil with optical weapons and 9mm tactical|Can carry 7 head-hurting grenades|75% faster reload with optical weapons and 9mm tactical|70% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with a Crossbow"
	 SRLevelEffects(7)="160% more headshot damage with optical weapons|65% more headshot damage with other weapons|450% extra headshot damage with an M99 AMR|32% faster fire speed with Crossbow/SVDc/M99|80% less recoil with optical weapons and 9mm tactical|Can carry 8 head-hurting grenades|80% faster reload with optical weapons and 9mm tactical|75% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with a Crossbow"
     SRLevelEffects(8)="180% more headshot damage with optical weapons|70% more headshot damage with other weapons|500% extra headshot damage with an M99 AMR|34% faster fire speed with Crossbow/SVDc/M99|85% less recoil with optical weapons and 9mm tactical|Can carry 9 head-hurting grenades|85% faster reload with optical weapons and 9mm tactical|75% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with a Crossbow"
     SRLevelEffects(9)="200% more headshot damage with optical weapons|75% more headshot damage with other weapons|550% extra headshot damage with an M99 AMR|36% faster fire speed with Crossbow/SVDc/M99|90% less recoil with optical weapons and 9mm tactical|Can carry 10 head-hurting grenades|90% faster reload with optical weapons and 9mm tactical|80% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with an M99 AMR"
     SRLevelEffects(10)="200% more headshot damage with optical weapons|75% more headshot damage with other weapons|550% extra headshot damage with an M99 AMR|36% faster fire speed with Crossbow/SVDc/M99|90% less recoil with optical weapons and 9mm tactical|Can carry 10 head-hurting grenades|90% faster reload with optical weapons and 9mm tactical|80% discount on Magnum44/Handcannon/M23/Vintorez/HK417/M99/SVD|Spawn with an M99 AMR and 100 armor|Elite abilities:|70% extra headshot damage with 9mm tactical|25% extra ammo|Weapon Mastery - 100% extra headshot damage with Crossbow"
}
